<?php

class NewsController extends FrontEndController
{
	/**
	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
	 * using two-column layout. See 'protected/views/layouts/column2.php'.
	 */
	public $layout='//layouts/column2';

	/**
	 * @return array action filters
	 */
	public function filters()
	{
		return array(
			'accessControl', // perform access control for CRUD operations
			'postOnly + delete', // we only allow deletion via POST request
		);
	}

	/**
	 * Specifies the access control rules.
	 * This method is used by the 'accessControl' filter.
	 * @return array access control rules
	 */
	public function accessRules()
	{
		return array(
			array('allow', // allow authenticated user to perform 'create' and 'update' actions
				'actions'=>array('index','create','update'),
				'users'=>array('@'),
			),
			array('deny',  // deny all users
				'users'=>array('*'),
			),
		);
	}

	public function actionIndex($id){	
		/*
		$user = self::loadModel($id);
		
		$comments = UsersComments::model()->findAll(array(
			'limit' 	=>	10,
			'order' 	=>	'id DESC',
			'condition'	=>	'(user_id=:user_id OR user_id=:profile_id) AND parent_id=0 AND profile_id=:profile_id',
			'params'	=>	array(':profile_id'=>$id, ':user_id'=>Yii::app()->user->id)
		));
		$countComments = count(UsersComments::model()->findAll(array(
			'condition'	=>	'(user_id=:user_id OR user_id=:profile_id) AND profile_id=:profile_id',
			'params'	=>	array(':profile_id'=>$id, ':user_id'=>Yii::app()->user->id)
		)));
		
		
		$this->render('index',array(
			'data'=>$user,
		));
		*/
	}
	public function actionUploadAvatar(){
	}
	public function actionUploadAvatarImg(){
	}
}
